<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>ProctorTicket.Trac</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ProctorTicket-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/proctorticket">ProctorTicket</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="ProctorTicket-module.html">Package&nbsp;ProctorTicket</a> ::
        Module&nbsp;Trac
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="ProctorTicket.Trac-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="ProctorTicket.Trac-module.html">Module ProctorTicket.Trac</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#  Trac.py -- Library for interfacing with Trac Tickets</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  Copyright (C) 2008 Zachary Voase &lt;cracka80@gmail.com&gt;</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  This program is free software; you can redistribute it and/or</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  modify it under the terms of the GNU General Public License</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  as published by the Free Software Foundation; either version 2</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  of the License, or (at your option) any later version.</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  GNU General Public License for more details.</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  You should have received a copy of the GNU General Public License</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  along with this program; if not, write to the Free Software</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  02110-1301, USA.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">"""ProctorTicket.Trac</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">Objectification of the Trac ticket system, to allow Proctor test results to</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">easily be inserted into a trac installation."""</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Module ProctorTicket.Utils=ProctorTicket.Utils-module.html"><a title="ProctorTicket.Utils" class="py-name" href="#" onclick="return doclink('link-0', 'Utils', 'link-0');">Utils</a></tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-name">trac</tt><tt class="py-op">.</tt><tt class="py-name">env</tt> <tt class="py-keyword">import</tt> <tt class="py-name">Environment</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-name">trac</tt><tt class="py-op">.</tt><tt class="py-name">Environment</tt> <tt class="py-keyword">import</tt> <tt class="py-name">Environment</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt id="link-1" class="py-name" targets="Variable ProctorTicket.Trac._TICKET_FIELDS=ProctorTicket.Trac-module.html#_TICKET_FIELDS"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-1', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">    <tt class="py-string">'id'</tt><tt class="py-op">,</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">    <tt class="py-string">'type'</tt><tt class="py-op">,</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">    <tt class="py-string">'time'</tt><tt class="py-op">,</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-string">'changetime'</tt><tt class="py-op">,</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">    <tt class="py-string">'component'</tt><tt class="py-op">,</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">    <tt class="py-string">'severity'</tt><tt class="py-op">,</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">    <tt class="py-string">'priority'</tt><tt class="py-op">,</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">    <tt class="py-string">'owner'</tt><tt class="py-op">,</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">    <tt class="py-string">'reporter'</tt><tt class="py-op">,</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">    <tt class="py-string">'cc'</tt><tt class="py-op">,</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">    <tt class="py-string">'version'</tt><tt class="py-op">,</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">    <tt class="py-string">'milestone'</tt><tt class="py-op">,</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">    <tt class="py-string">'status'</tt><tt class="py-op">,</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">    <tt class="py-string">'resolution'</tt><tt class="py-op">,</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">    <tt class="py-string">'summary'</tt><tt class="py-op">,</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-string">'description'</tt><tt class="py-op">,</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">    <tt class="py-string">'keywords'</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-op">]</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"> </tt>
<a name="ValidKeys"></a><div id="ValidKeys-def"><a name="L49"></a><tt class="py-lineno"> 49</tt> <a class="py-toggle" href="#" id="ValidKeys-toggle" onclick="return toggle('ValidKeys');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac-module.html#ValidKeys">ValidKeys</a><tt class="py-op">(</tt><tt class="py-param">dictIn</tt><tt class="py-op">,</tt> <tt class="py-param">keyList</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ValidKeys-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ValidKeys-expanded"><a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">    <tt class="py-docstring">"""ValidKeys(&lt;dictionary&gt;, &lt;iterable&gt;):</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-docstring">Check if a dictionary's keys are all valid, with valid keys specified in the</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">second positional argument. Returns True/False."""</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt class="py-name">valid_keys</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">keyList</tt><tt class="py-op">)</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">    <tt class="py-name">keys</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">dictIn</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">keys</tt><tt class="py-op">.</tt><tt class="py-name">difference</tt><tt class="py-op">(</tt><tt class="py-name">valid_keys</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-number">0</tt> </tt>
</div><a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"> </tt>
<a name="GetInvalidKeys"></a><div id="GetInvalidKeys-def"><a name="L57"></a><tt class="py-lineno"> 57</tt> <a class="py-toggle" href="#" id="GetInvalidKeys-toggle" onclick="return toggle('GetInvalidKeys');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac-module.html#GetInvalidKeys">GetInvalidKeys</a><tt class="py-op">(</tt><tt class="py-param">dictIn</tt><tt class="py-op">,</tt> <tt class="py-param">keyList</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GetInvalidKeys-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GetInvalidKeys-expanded"><a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">    <tt class="py-docstring">"""GetInvalidKeys(&lt;dictionary&gt;, &lt;iterable&gt;):</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-docstring">Returns a list of the invalid key entries in the dictionary, according to valid</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">ones specified in the second positional argument."""</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt class="py-name">valid_keys</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">keyList</tt><tt class="py-op">)</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">    <tt class="py-name">keys</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">dictIn</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">list</tt><tt class="py-op">(</tt><tt class="py-name">keys</tt><tt class="py-op">.</tt><tt class="py-name">difference</tt><tt class="py-op">(</tt><tt class="py-name">valid_keys</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"> </tt>
<a name="TracDBConn"></a><div id="TracDBConn-def"><a name="L65"></a><tt class="py-lineno"> 65</tt> <a class="py-toggle" href="#" id="TracDBConn-toggle" onclick="return toggle('TracDBConn');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html">TracDBConn</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TracDBConn-expanded"><a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">    <tt class="py-docstring">"""TracDBConn(&lt;string&gt;, &lt;preLoadDict: dictionary()&gt;, &lt;update: bool(True)&gt;):</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring">Class to provide abstractions for the Trac database connection. Upon</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-docstring">instantiation, accepts the path to Trac installation. By specifying a value</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-docstring">for preLoadDict, every time a ticket is added default options will be loaded</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-docstring">from the dictionary, meaning, for example, you would only need to specify</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-docstring">the summary and description and could have a default value for priority, etc.</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring">The 'update' keyword, which is True by default, tells ProctorTicket that, when</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">adding a ticket, if it already exists, to update the changed fields instead</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">of raising an error."""</tt> </tt>
<a name="TracDBConn.__init__"></a><div id="TracDBConn.__init__-def"><a name="L75"></a><tt class="py-lineno"> 75</tt> <a class="py-toggle" href="#" id="TracDBConn.__init__-toggle" onclick="return toggle('TracDBConn.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">preLoadDict</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-param">update</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.__init__-expanded"><a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">env</tt> <tt class="py-op">=</tt> <tt class="py-name">Environment</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">env</tt><tt class="py-op">.</tt><tt class="py-name">get_db_cnx</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">autocommit</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-2" class="py-name" targets="Function ProctorTicket.Trac.ValidKeys()=ProctorTicket.Trac-module.html#ValidKeys"><a title="ProctorTicket.Trac.ValidKeys" class="py-name" href="#" onclick="return doclink('link-2', 'ValidKeys', 'link-2');">ValidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">preLoadDict</tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-3', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">KeyError</tt><tt class="py-op">(</tt><tt class="py-string">"Invalid fields in preLoadDict: %r"</tt> <tt class="py-op">%</tt> \ </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt id="link-4" class="py-name" targets="Function ProctorTicket.Trac.GetInvalidKeys()=ProctorTicket.Trac-module.html#GetInvalidKeys"><a title="ProctorTicket.Trac.GetInvalidKeys" class="py-name" href="#" onclick="return doclink('link-4', 'GetInvalidKeys', 'link-4');">GetInvalidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">,</tt> <tt id="link-5" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-5', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">preLoadDict</tt> <tt class="py-op">=</tt> <tt id="link-6" class="py-name"><a title="ProctorTicket.Utils" class="py-name" href="#" onclick="return doclink('link-6', 'Utils', 'link-0');">Utils</a></tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Function ProctorTicket.Utils.dictFilter()=ProctorTicket.Utils-module.html#dictFilter"><a title="ProctorTicket.Utils.dictFilter" class="py-name" href="#" onclick="return doclink('link-7', 'dictFilter', 'link-7');">dictFilter</a></tt><tt class="py-op">(</tt><tt id="link-8" class="py-name"><a title="ProctorTicket.Utils" class="py-name" href="#" onclick="return doclink('link-8', 'Utils', 'link-0');">Utils</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Function ProctorTicket.Utils.dictEmptiness()=ProctorTicket.Utils-module.html#dictEmptiness"><a title="ProctorTicket.Utils.dictEmptiness" class="py-name" href="#" onclick="return doclink('link-9', 'dictEmptiness', 'link-9');">dictEmptiness</a></tt><tt class="py-op">,</tt> <tt class="py-name">preLoadDict</tt><tt class="py-op">)</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">update</tt> <tt class="py-op">=</tt> <tt class="py-name">update</tt> </tt>
</div><a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">     </tt>
<a name="TracDBConn.checkTicket"></a><div id="TracDBConn.checkTicket-def"><a name="L85"></a><tt class="py-lineno"> 85</tt> <a class="py-toggle" href="#" id="TracDBConn.checkTicket-toggle" onclick="return toggle('TracDBConn.checkTicket');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#checkTicket">checkTicket</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">,</tt> <tt class="py-param">field</tt><tt class="py-op">=</tt><tt class="py-string">"summary"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.checkTicket-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.checkTicket-expanded"><a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-docstring">"""TracDBConn.checkTicket(&lt;string&gt;, &lt;field: "summary"&gt;):</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-docstring">Returns True or False, depending on whether a ticket already exists in the</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-docstring">database with a value for 'field' equal to the first argument."""</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">assert</tt> <tt class="py-name">field</tt> <tt class="py-keyword">in</tt> <tt id="link-10" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-10', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">,</tt> <tt class="py-string">"Field '%s' not valid"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">field</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-name">cur</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-name">SQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"SELECT COUNT(id) FROM ticket WHERE "</tt> <tt class="py-op">+</tt> <tt class="py-name">field</tt> <tt class="py-op">+</tt> <tt class="py-string">"=%s"</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-name">SQLData</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> <tt class="py-name">value</tt> <tt class="py-op">]</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-name">resultsProxy</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">execute</tt><tt class="py-op">(</tt><tt class="py-name">SQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">SQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">:</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">.</tt><tt class="py-name">fetchall</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">fetchall</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">results</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">0</tt> </tt>
</div><a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">     </tt>
<a name="TracDBConn.getTicketID"></a><div id="TracDBConn.getTicketID-def"><a name="L100"></a><tt class="py-lineno">100</tt> <a class="py-toggle" href="#" id="TracDBConn.getTicketID-toggle" onclick="return toggle('TracDBConn.getTicketID');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#getTicketID">getTicketID</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">,</tt> <tt class="py-param">field</tt><tt class="py-op">=</tt><tt class="py-string">"summary"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.getTicketID-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.getTicketID-expanded"><a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-docstring">"""TracDBConn.getTicketID(&lt;string&gt;, &lt;field: string("summary")&gt;):</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-docstring">Returns the 'id' field for the first record with a 'field' value equal</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-docstring">to the first positional argument."""</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-keyword">assert</tt> <tt class="py-name">field</tt> <tt class="py-keyword">in</tt> <tt id="link-11" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-11', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">,</tt> <tt class="py-string">"Field '%s' not valid"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">field</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-name">cur</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-name">SQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"SELECT id FROM ticket WHERE "</tt> <tt class="py-op">+</tt> <tt class="py-name">field</tt> <tt class="py-op">+</tt> <tt class="py-string">"=%s"</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-name">SQLData</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">resultsProxy</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">execute</tt><tt class="py-op">(</tt><tt class="py-name">SQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">SQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">.</tt><tt class="py-name">fetchone</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">            <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">fetchone</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">results</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">     </tt>
<a name="TracDBConn.addTicket"></a><div id="TracDBConn.addTicket-def"><a name="L118"></a><tt class="py-lineno">118</tt> <a class="py-toggle" href="#" id="TracDBConn.addTicket-toggle" onclick="return toggle('TracDBConn.addTicket');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#addTicket">addTicket</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ticketDict</tt><tt class="py-op">,</tt> <tt class="py-param">preLoad</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.addTicket-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.addTicket-expanded"><a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">        <tt class="py-docstring">"""TracDBConn.addTicket(&lt;dictionary&gt;, &lt;preLoad: boolean(True)&gt;):</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"><tt class="py-docstring">Takes the dictionary given, makes sure all keys are valid, and inserts the</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"><tt class="py-docstring">specified ticket into the database. Returns the id of the ticket created.</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line"><tt class="py-docstring">Also loads data for each ticket from the 'preLoadDict' attribute, unless </tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line"><tt class="py-docstring">preLoad=False is specified as an optional argument."""</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-12" class="py-name"><a title="ProctorTicket.Trac.ValidKeys" class="py-name" href="#" onclick="return doclink('link-12', 'ValidKeys', 'link-2');">ValidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-13', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">KeyError</tt><tt class="py-op">(</tt><tt class="py-string">"Invalid fields in ticketDict: %r"</tt> <tt class="py-op">%</tt> \ </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt id="link-14" class="py-name"><a title="ProctorTicket.Trac.GetInvalidKeys" class="py-name" href="#" onclick="return doclink('link-14', 'GetInvalidKeys', 'link-4');">GetInvalidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">,</tt> <tt id="link-15" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-15', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">        <tt class="py-name">SQLDict</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">preLoad</tt><tt class="py-op">:</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">preLoadDict</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">                <tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">ticketDict</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">            <tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-string">'changetime'</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-name">SQLDict</tt><tt class="py-op">:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">            <tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-string">'changetime'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-string">'time'</tt><tt class="py-op">]</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-string">'keywords'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">SQLDict</tt><tt class="py-op">:</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">            <tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-string">'keywords'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">" "</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">SQLDict</tt><tt class="py-op">[</tt><tt class="py-string">'keywords'</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">        <tt class="py-name">cur</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">        <tt class="py-name">SQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"INSERT INTO ticket ( %s ) VALUES ( %s )"</tt> <tt class="py-op">%</tt> \ </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">            <tt class="py-op">(</tt> <tt class="py-string">", "</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">SQLDict</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">" ,"</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">"%s"</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">SQLDict</tt><tt class="py-op">.</tt><tt class="py-name">values</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">        <tt class="py-name">SQLData</tt> <tt class="py-op">=</tt> <tt class="py-name">map</tt><tt class="py-op">(</tt> <tt class="py-name">str</tt><tt class="py-op">,</tt> <tt class="py-name">SQLDict</tt><tt class="py-op">.</tt><tt class="py-name">values</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">        <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">execute</tt><tt class="py-op">(</tt><tt class="py-name">SQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">SQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">commit</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">get_last_id</tt><tt class="py-op">(</tt><tt class="py-name">cur</tt><tt class="py-op">,</tt> <tt class="py-string">'ticket'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">     </tt>
<a name="TracDBConn.updateTicket"></a><div id="TracDBConn.updateTicket-def"><a name="L145"></a><tt class="py-lineno">145</tt> <a class="py-toggle" href="#" id="TracDBConn.updateTicket-toggle" onclick="return toggle('TracDBConn.updateTicket');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#updateTicket">updateTicket</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ticketID</tt><tt class="py-op">,</tt> <tt class="py-param">changeDict</tt><tt class="py-op">,</tt> <tt class="py-param">author</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.updateTicket-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.updateTicket-expanded"><a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">        <tt class="py-docstring">"""TracDBConn.updateTicket(&lt;integer&gt;, &lt;dictionary&gt;, &lt;author: string()&gt;):</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring">This accepts a ticket ID and a dictionary of changed values, and updates the</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">database with new values for that ID. It also adds records to ticket_change,</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">so that changes are logged. The dictionary argument does not have to include</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">time, but if it is it will override the default action of getting the current</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">time from time.localtime(). The 'author' keyword specifies who should be the</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring">author of the change; by default this field takes the value of the reporter,</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line"><tt class="py-docstring">or else the owner, of the ticket."""</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-16" class="py-name"><a title="ProctorTicket.Trac.ValidKeys" class="py-name" href="#" onclick="return doclink('link-16', 'ValidKeys', 'link-2');">ValidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">changeDict</tt><tt class="py-op">,</tt> <tt id="link-17" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-17', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">KeyError</tt><tt class="py-op">(</tt><tt class="py-string">"Invalid fields in update dictionary: %r"</tt> <tt class="py-op">%</tt> \ </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt id="link-18" class="py-name"><a title="ProctorTicket.Trac.GetInvalidKeys" class="py-name" href="#" onclick="return doclink('link-18', 'GetInvalidKeys', 'link-4');">GetInvalidKeys</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">,</tt> <tt id="link-19" class="py-name"><a title="ProctorTicket.Trac._TICKET_FIELDS" class="py-name" href="#" onclick="return doclink('link-19', '_TICKET_FIELDS', 'link-1');">_TICKET_FIELDS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">        <tt class="py-name">updateCursor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-name">SETStmt</tt> <tt class="py-op">=</tt> <tt class="py-string">", "</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt> <tt class="py-name">key</tt> <tt class="py-op">+</tt> <tt class="py-string">"=%s"</tt> <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt class="py-name">changeDict</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt class="py-name">USQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"UPDATE ticket SET "</tt> <tt class="py-op">+</tt> <tt class="py-name">SETStmt</tt> <tt class="py-op">+</tt> <tt class="py-string">" WHERE id=%s"</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">        <tt class="py-name">USQLData</tt> <tt class="py-op">=</tt> <tt class="py-name">map</tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">,</tt> <tt class="py-name">changeDict</tt><tt class="py-op">.</tt><tt class="py-name">values</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-op">[</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">        <tt class="py-name">updateCursor</tt><tt class="py-op">.</tt><tt class="py-name">execute</tt><tt class="py-op">(</tt><tt class="py-name">USQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">USQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">        <tt class="py-comment"># Begin insertion of ticket_change</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">insertCursor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">        <tt class="py-name">ISQLData</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">        <tt class="py-name">author</tt> <tt class="py-op">=</tt> <tt class="py-name">author</tt> <tt class="py-keyword">or</tt> <tt class="py-name">changeDict</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-string">"reporter"</tt><tt class="py-op">,</tt> <tt class="py-name">changeDict</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-string">"owner"</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">author</tt><tt class="py-op">:</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">            <tt class="py-name">ISQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"INSERT INTO ticket_change(ticket, time, field, oldvalue, newvalue) VALUES ( %s, %s, %s, %s, %s )"</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">            <tt class="py-name">ISQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"INSERT INTO ticket_change(ticket, time, author, field, oldvalue, newvalue) VALUES ( %s, %s, %s, %s, %s, %s )"</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">changeDict</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt> <tt class="py-string">"time"</tt><tt class="py-op">,</tt> <tt class="py-string">"changetime"</tt> <tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">                <tt class="py-keyword">continue</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">author</tt><tt class="py-op">:</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">                    <tt class="py-name">ISQLData</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Method ProctorTicket.Utils.FilteredList.append()=ProctorTicket.Utils.FilteredList-class.html#append"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-20', 'append', 'link-20');">append</a></tt><tt class="py-op">(</tt> <tt class="py-op">[</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">changeDict</tt><tt class="py-op">[</tt><tt class="py-string">"time"</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-string">"( SELECT %s FROM ticket WHERE id=%s )"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">                    <tt class="py-name">ISQLData</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-21', 'append', 'link-20');">append</a></tt><tt class="py-op">(</tt> <tt class="py-op">[</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">changeDict</tt><tt class="py-op">[</tt><tt class="py-string">"time"</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">author</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-string">"( SELECT %s FROM ticket WHERE id=%s )"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">        <tt class="py-name">insertCursor</tt><tt class="py-op">.</tt><tt class="py-name">executemany</tt><tt class="py-op">(</tt><tt class="py-name">ISQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">ISQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">commit</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">     </tt>
<a name="TracDBConn.checkAndAddOrUpdate"></a><div id="TracDBConn.checkAndAddOrUpdate-def"><a name="L181"></a><tt class="py-lineno">181</tt> <a class="py-toggle" href="#" id="TracDBConn.checkAndAddOrUpdate-toggle" onclick="return toggle('TracDBConn.checkAndAddOrUpdate');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Trac.TracDBConn-class.html#checkAndAddOrUpdate">checkAndAddOrUpdate</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ticketDict</tt><tt class="py-op">,</tt> <tt class="py-param">field</tt><tt class="py-op">=</tt><tt class="py-string">"summary"</tt><tt class="py-op">,</tt> <tt class="py-param">preLoad</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TracDBConn.checkAndAddOrUpdate-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TracDBConn.checkAndAddOrUpdate-expanded"><a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">        <tt class="py-docstring">"""TracDBConn.checkAndAddOrUpdate(&lt;dictionary&gt;, &lt;field: string("summary")&gt;, &lt;preLoad: True&gt;)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">Makes sure that a ticket is not already in the database and then adds it and</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring">returns the new record's 'id' field.</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"><tt class="py-docstring">If it is in the database already then the program tries to see whether the</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-docstring">description field has changed. If it has then it performs an update."""</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Method ProctorTicket.Trac.TracDBConn.checkTicket()=ProctorTicket.Trac.TracDBConn-class.html#checkTicket"><a title="ProctorTicket.Trac.TracDBConn.checkTicket" class="py-name" href="#" onclick="return doclink('link-22', 'checkTicket', 'link-22');">checkTicket</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">[</tt><tt class="py-name">field</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">field</tt><tt class="py-op">=</tt><tt class="py-name">field</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Method ProctorTicket.Trac.TracDBConn.addTicket()=ProctorTicket.Trac.TracDBConn-class.html#addTicket"><a title="ProctorTicket.Trac.TracDBConn.addTicket" class="py-name" href="#" onclick="return doclink('link-23', 'addTicket', 'link-23');">addTicket</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">,</tt> <tt class="py-name">preLoad</tt><tt class="py-op">=</tt><tt class="py-name">preLoad</tt><tt class="py-op">)</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">update</tt><tt class="py-op">:</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">AssertionError</tt><tt class="py-op">(</tt><tt class="py-string">"Ticket '%s' already exists"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">[</tt><tt class="py-string">"summary"</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">            <tt class="py-name">cur</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">cursor</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">            <tt class="py-name">ticketID</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method ProctorTicket.Trac.TracDBConn.getTicketID()=ProctorTicket.Trac.TracDBConn-class.html#getTicketID"><a title="ProctorTicket.Trac.TracDBConn.getTicketID" class="py-name" href="#" onclick="return doclink('link-24', 'getTicketID', 'link-24');">getTicketID</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">[</tt><tt class="py-string">"summary"</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">            <tt class="py-name">SQLExpr</tt> <tt class="py-op">=</tt> <tt class="py-string">"SELECT description FROM ticket WHERE id=%s"</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">            <tt class="py-name">SQLData</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-name">resultsProxy</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">execute</tt><tt class="py-op">(</tt><tt class="py-name">SQLExpr</tt><tt class="py-op">,</tt> <tt class="py-name">SQLData</tt><tt class="py-op">)</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">:</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">                <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">resultsProxy</tt><tt class="py-op">.</tt><tt class="py-name">fetchone</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">                <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">cur</tt><tt class="py-op">.</tt><tt class="py-name">fetchone</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">            <tt class="py-name">oldDesc</tt> <tt class="py-op">=</tt> <tt class="py-name">results</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">            <tt class="py-name">oldDescSet</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">oldDesc</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"-"</tt><tt class="py-op">*</tt><tt class="py-number">20</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">            <tt class="py-name">newDesc</tt> <tt class="py-op">=</tt> <tt class="py-name">ticketDict</tt><tt class="py-op">[</tt><tt class="py-string">"description"</tt><tt class="py-op">]</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">            <tt class="py-name">newDescSet</tt> <tt class="py-op">=</tt> <tt class="py-name">set</tt><tt class="py-op">(</tt><tt class="py-name">newDesc</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"-"</tt><tt class="py-op">*</tt><tt class="py-number">20</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">newDescSet</tt><tt class="py-op">.</tt><tt class="py-name">symmetric_difference</tt><tt class="py-op">(</tt><tt class="py-name">oldDescSet</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Method ProctorTicket.Trac.TracDBConn.updateTicket()=ProctorTicket.Trac.TracDBConn-class.html#updateTicket"><a title="ProctorTicket.Trac.TracDBConn.updateTicket" class="py-name" href="#" onclick="return doclink('link-25', 'updateTicket', 'link-25');">updateTicket</a></tt><tt class="py-op">(</tt><tt class="py-name">ticketID</tt><tt class="py-op">,</tt> <tt class="py-name">ticketDict</tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">ticketID</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt class="py-name">AssertionError</tt><tt class="py-op">(</tt><tt class="py-string">"Ticket '%s' already exists"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">ticketDict</tt><tt class="py-op">[</tt><tt class="py-string">"summary"</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ProctorTicket-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/proctorticket">ProctorTicket</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Sat Jan 19 19:26:41 2008
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
